<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Data-Table 表格</title>
    <link rel="stylesheet" href="../../frame/layui/css/layui.css">
    <link rel="stylesheet" href="../../frame/static/css/style.css">
    <link rel="stylesheet" href="../../css/common.css">
    <style>
        img{
            height: 100%;
        }
    </style>
</head>
<body class="body">
<!-- 工具集 -->
<div class="my-btn-box">
    <span class="fl">
        <a class="layui-btn btn-add btn-default" id="btn-refresh" onclick="location.reload()"><i class="layui-icon">&#x1002;</i></a>
    </span>
</div>

<!-- 表格 -->
<div class="dateTable">
    <div class="table-title">
        <div style="width: 20%">参数名</div>
        <div style="width: 20%">参数</div>
        <div style="width: 10%" >操作</div>
    </div>
    <table class="data-table" id="data-table">
    </table>
</div>
<script src="../../js/public/jquery-3.1.1.min.js"></script>
<script src="../../js/layer/layer.js"></script>
<script src="../../js/public/common.js"></script>
<script>
    $(function(){
        GetList();
        $('.edit').click(function(){
          	let re = $(this).attr('data');
            let id = $(this).attr('ids');
            layOpen('设置','500px','500px','edit.html?id='+id+'&re='+re);
        })
    });
    function GetList(){
       let data = AjaxForm('admin/data/index');
      	console.log(data);
       let html=``;
       for (let i=0;i<data.length;i++){
           html += `<tr class="table-content" style='height: 50px;'>
                    <td style="width: 20%">${data[i].desc}</td>
                    <td style="width: 20%;overflow: hidden;text-overflow:ellipsis;">${data[i].x}</td>
                    <td style="width: 10%">
                        <a class="layui-btn btn-default edit" ids="${data[i].id}" data="${data[i].x}">设置</a>
                    </td>
                    </tr>
                `;
       }
       $('#data-table').html(html);
    }
</script>
</body>
</html>